package com.k4rthik.clipall.ui;

import com.k4rthik.clipall.commons.PropertyHandler;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;

/**
 * Created with IntelliJ IDEA.
 * User: Perseus
 * Date: 8/4/12
 * Time: 12:45 AM
 */

public class AboutTab extends JPanel
{
    public AboutTab()
    {
        super(new GridLayout(3,3));
        setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

        JButton iconButton = new JButton(new ImageIcon(PropertyHandler.get("PROGRAM_ICON")));
        iconButton.setToolTipText("Visit Developer Homepage");
        iconButton.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent event)
            {
                try
                {
                    Desktop openDesktop = Desktop.getDesktop();
                    if(openDesktop.isSupported(Desktop.Action.BROWSE))
                    {
                        openDesktop.browse(new URI(PropertyHandler.get("DEVELOPER_HOME_PAGE")));
                    }
                } catch (Exception e) {
                    /* Ignore */
                }
            }
        });

        add(iconButton);

        JLabel titleText = new JLabel("ClipB-Share");
        titleText.setFont(new Font(titleText.getFont().getFontName(), Font.BOLD, 24));
        add(titleText);
    }
}
